import os
import logzero
from app import config
from pathlib import Path

class log :
    def __init__(self) :
        my_file_path = Path(config.logPath)
        if my_file_path.exists() == 0:
            os.makedirs(config.logPath)
        my_file = Path(config.logPath + '/sql.log')
        if my_file.exists() == 0:
            file_temp = open(config.logPath + '/sql.log', 'w')
            file_temp.close()
        self.logfile = os.path.join(config.logPath, 'sql.log')
        logzero.logfile(self.logfile, maxBytes = 1e6, backupCount = 3)
        import logging
        formatter = logging.Formatter('%(asctime)-15s - [%(filename)s: %(lineno)s] -%(levelname)s: %(message)s');
        logzero.formatter(formatter)
        self.logger = logzero.logger



if __name__ == '__main__':
    input("You can not run main!")


